package com.hcbd.tdwt.ui.fuda.common.vo.weather;

/**
 * 风向结构体
 *
 * @author ZhDZ
 * @Date 2019年7月29日
 */
public enum WindDirType {
    //无风向
    NoDir(0, "无持续风向"),
    North(1, "北风"),
    EastNorth(2, "东北风"),
    East(3, "东风"),
    EastSouth(4, "东南风"),
    South(5, "南风"),
    WestSouth(6, "西南风"),
    West(7, "西风"),
    WeatNorth(8, "西北风"),
    //旋转风
    Rotation(9, "旋转风");

    private int val;
    private String name;

    public static WindDirType get(int v) {
        for (WindDirType w : WindDirType.values()) {
            if (w.getVal() == v) {
                return w;
            }
        }
        return NoDir;
    }

    public static WindDirType get(String n) {
        for (WindDirType w : WindDirType.values()) {
            if (w.getName().equals(n)) {
                return w;
            }
        }
        return NoDir;
    }

    private WindDirType(int val, String name) {
        this.val = val;
        this.name = name;
    }

    public int getVal() {
        return val;
    }

    public void setVal(int val) {
        this.val = val;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
